package cn.easthome.demo.day0060_pm;

import cn.easthome.demo.day0060_pm.service.IJobInfoService;
import cn.easthome.demo.day0060_pm.service.JobInfoServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Center2Servlet", value = "/Center2Servlet")
public class Center2Servlet extends HttpServlet {
    private IJobInfoService jobInfoService = new JobInfoServiceImpl();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        //查询数据库获取center2的数据
        String jsonStr = jobInfoService.getCenter2Str();
        response.getWriter().write(jsonStr);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
